<script language="javascript">
    function checkAll()
    {ldelim}
    	if ( $("input:checkbox").is(':checked') == true) {ldelim}
    		$("input:checkbox").removeAttr("checked");
    		$("#CHK_ALL a").text("##SELECT_ALL##");
    	{rdelim} else {ldelim}
    		$("input:checkbox").attr("checked", "checked");
    		$("#CHK_ALL a").text("##NONE_SELECT_ALL##");
    	{rdelim}
    {rdelim}
    /**
     * |--- executeFunc ---|
     */
	function executeFunc( task )
	{ldelim}
		switch( task )
		{ldelim}
			case 'add_modules':
				window.location = '{$urlControlName}' + '&m=add';
				break;

			case 'edit_modules':

				if ( $("input:checked").length > 1) {ldelim}
					alert('##TEM_MAN_JS_ONE_RECORD_EDIT_ONLY##');
					return false;

				{rdelim} else if ($("input:checked").length == 1) {ldelim}
					var linkEdit = '{$urlControlName}' + '&m=edit' + '&id=' + $("input:checked").val();
					window.location  = linkEdit;

				{rdelim} else {ldelim}
					alert('##TEM_MAN_JS_NOT_CHOOSE_RECORD_YET##');
					return false;

				{rdelim}
				break;
		{rdelim}
	{rdelim}

	/**
	 * editFunct
	 */
    function editFunct(id)
    {ldelim}
    	window.location = '{$urlControlName}&m=edit&news_id=' + id;
    {rdelim}

    /**
     * delFunct
     */
    function delFunct(id)
    {ldelim}
		if (confirm('Bạn thật sự muốn xóa Bản tin này ?')) {ldelim}
			window.location = '{$urlControlName}&m=del&news_id=' + id;
		{rdelim}
    {rdelim}
</script>
<div id="leftBox">

<div class="{$clsType}Box" style="display:{$msgBoxDisp}">
  <div class="{$clsType}BoxTop">&nbsp;</div>
  	{foreach from=$messages item=arrMsg}
    	{foreach from=$arrMsg item=msg}
    	<div class="msgBoxContent {$clsIcon}">
      	<p>{$msg}</p>
      	</div>
      {/foreach}
    {/foreach}
</div>

<div class="contentBox">
    <div class="contentBoxTop">
      <h3>##MANAGEMENT## Tin Bất động sản</h3>
    </div>

    <div class="innerContent">
      <form id="form2" name="form2" method="post" action="">
        <table class="sTable">
          <thead>
            <tr>
              <th width="60"><strong>##LIST_INDEX##</strong></th>
              <th align="left"><strong>##LIST_NAME## Tin Bất động sản</strong></th>
              <th><strong>##LIST_FUNC##</strong></th>
            </tr>
          </thead>

              {foreach from=$modulesList item=module}
              <tr class="oddRow">
                <td class="firstCol"><input type="checkbox" name="cat_id{$module->news_id}" id="cat_id[{$module->news_id}]" value="{$module->news_id}"/></td>
                <td class="secondCol" align="left">
                	<a style="text-decoration:none;" >{$module->news_title|escape}</a>
                </td>
                <td class="editItem"><ul>
                    <li class="iconEdit"><a href="javascript:void(0)" onclick="editFunct('{$module->news_id}');">##EDIT_ICON##</a></li>
                    <li class="iconEdit"><a href="javascript:void(0)" onclick="delFunct('{$module->news_id}');">##DEL_ICON##</a></li>
                  </ul></td>
              </tr>
              {/foreach}

          </table>
        <p id="CHK_ALL"><a href="javascript:void(0)" onclick="checkAll()" class="deleteLink">##SELECT_ALL##</a>
        	<div align="right">{$paging}</div>
        </p>
      </form>
    </div>
    <!--end of #box-3-->
</div>
</div>

<div id="sidebar" class="rightBoxes">
  <div class="rightBoxesTop">
    <h3>##LIST_FUNC##</h3>
  </div>
  <div class="rightContent">
    <ul id="sidebarLinks">
	  <li><a href="javascript:void(0);" onclick="javascript:executeFunc('add_modules')">##LIST_ADD## Tin Bất động sản</a></li>
      <li><a href="javascript:void(0);" onclick="javascript:executeFunc('edit_modules')">##LIST_EDIT## Tin Bất động sản</a></li>
    </ul>
  </div>
</div>
<!-- end of #sidebar -->
